#include "stdafx.h"
#include "SigSite.h"
#include "SigSource.h"

using namespace Base::Sig;

SigSite::SigSite()
    : m_sigSource(0)
{
}

SigSite::~SigSite()
{
    if (   m_sigSource 
        && m_sigSource->hookedWith(this))
    {
        m_sigSource->unhook(this);
    }

    assert(0 == m_sigSource);
}

SigSource*
SigSite::sigSource() const
{
    return m_sigSource;
}

void
SigSite::sigSource(SigSource* sigSource)
{
    if (m_sigSource != sigSource)
    {
        m_sigSource = sigSource;
    }
}

bool
SigSite::hooked() const
{
    return (0 != m_sigSource);
}